﻿@{
    Layout = null;

   

}
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>用户反馈</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0,maximum-scale=1.0, user-scalable=no" />
    <link rel="stylesheet" href="~/Content/css/base.css" />
    <link rel="stylesheet" href="~/Content/css/tuoken.css" />
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script type="text/javascript" src="~/Content/js/base.js"></script>
    <script src="~/Content/js/layer/1.9.3/layer.js"></script>
</head>

<body>
    <div class="header">
        <a href="javascript:history.go(-1);">
            <span class="back"></span>
        </a>
        <div class="hdtitle">
            用户反馈
        </div>
    </div>

    <div class="property">

        <div class="user_feedback">
            <textarea class="wordtext" id="wordtext" placeholder="请输入您的意见或者建议"></textarea>
            <p class="feedback_sum">
                <span id="wordage">0</span>/
                <span id="sum">500</span>
            </p>
            <input type="text" id="contact" placeholder="请输入您的联系或邮箱地址">
            <p class="info">为了更方便联系到您，请填写您的联系方式！</p>
        </div>
        <input type="submit" class="user_feedbackbtn" id="submitbtn" onclick="submit()" value="提交" />
      
    </div>

    <script type="text/javascript">
        /*字数限制*/
        $("#wordtext").on("input propertychange", function () {
            if (!$("#wordtext").val() == "") {
                $("#submitbtn").addClass('on')
            }
            else {
                $("#submitbtn").removeClass('on')
            }
            var $this = $(this),
                _val = $this.val(),
                count = "";
            if (_val.length > 500) {
                $this.val(_val.substring(0, 500));
            }
            count = 500 - $this.val().length;
            $("#wordage").text(count);
        });
        function submit() {
         
            var storage = window.localStorage;
            if ($("#wordtext").val() == "") {
                layer.msg("请输入内容");
            } else {
                $.ajax({
                    //几个参数需要注意一下
                    type: "POST",//方法类型
                    dataType: "json",//预期服务器返回的数据类型
                    url: "/User/SaveFeedback",//url
                    data: { Content: $("#wordtext").val(), Contact: $("#contact").val()},
                    success: function (result) {
                        if (result.msg == "操作成功") {
                            window.location.href = "/User/Sucess";
                        } else {
                            layer.msg(result.msg);
                        }
                    },
                    error: function () {
                        layer.msg("异常！");
                    }
                });
            }
        }
    </script>
</body>

</html>